package com.yqg.protection.entity;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.FieldStrategy;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yqg.protection.common.ListInteger2ListLongTypeHandler;
import com.yqg.protection.cover.IsOnlineConverter;
import com.yqg.protection.cover.UserStateConverter;
import com.yqg.protection.cover.WhetherConverter;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * user 实体类
 * @author zxf
 * @since 2024-01-01
 */
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
  @ApiModel(value = "User对象", description = "")
public class User implements Serializable {

    private static final long serialVersionUID = 1L;

    @ExcelProperty(value = "用户ID",index = 0)
      @TableId(value = "id", type = IdType.AUTO)
      private Long id;

    @ExcelProperty(value = "用户名",index = 1)
    private String username;

    @ExcelProperty(value = "密码",index = 2)
    private String password;

    @ExcelProperty(value = "组织ID",index = 3)
    private Long organization;

    @ExcelProperty(value = "是否监管全部下级单位",index = 4,converter = WhetherConverter.class)
    private String isAllClient;

    @ExcelProperty(value = "监管单位",index = 5)
    @TableField(exist = false)
    private String clientIdsStr;

    @ExcelIgnore
    @TableField(value = "client_ids", typeHandler = ListInteger2ListLongTypeHandler.class, updateStrategy = FieldStrategy.IGNORED)
    private List<Long> clientIds;

    @ExcelIgnore
    private Integer role;

    @ExcelProperty(value = "创建时间",index = 6)
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
    private Date createTime;

    @ExcelProperty(value = "修改时间",index = 7)
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
    private Date updateTime;

    @ExcelIgnore
    private Integer isDelete;

    @ExcelProperty(value = "状态",index = 8,converter = UserStateConverter.class)
    private String state;

    @ExcelProperty(value = "是否在线",index = 9,converter = IsOnlineConverter.class)
    private String isOnline;

    @ExcelProperty(value = "在线方式",index = 10)
    private String onlineWay;

    // 当前登陆设备标识
    @ExcelIgnore
    private String oaid;

    @ExcelIgnore
    private Long lastLoginTime;

    @ExcelIgnore
    private Long superviLength;

    @ExcelProperty(value = "安全责任人",index = 11)
    private String safeResponMan;

    @ExcelProperty(value = "安全管理人",index = 12)
    private String safeManager;

    @ExcelProperty(value = "负责人电话",index = 13)
    private String safeTelephone;

    @ExcelProperty(value = "电话",index = 14)
    private String telephone;

    @ExcelProperty(value = "顶部配置",index = 15)
    private String configure;

    @ExcelProperty(value = "邮箱",index = 16)
    private String email;

    @ExcelProperty(value = "appkey",index = 17)
    private String appkey;

    @ExcelProperty(value = "secret",index = 18)
    private String secret;

    @ExcelProperty(value = "url",index = 19)
    private String url;

    @ExcelIgnore
    private String isSmsReceiv;

    @ExcelIgnore
    private String isTelReceiv;

    @ExcelProperty(value = "用户角色",index = 20)
    @TableField(exist = false)
    private String rolename;

    @ExcelProperty(value = "组织名称",index = 21)
    @TableField(exist = false)
    private String organizationName;

    @ExcelIgnore
    @TableField(exist = false)
    @ApiModelProperty("单位名称")
    private List<String> clientNames;

    @ExcelProperty(value = "监管时长(小时)",index = 22)
    @TableField(exist = false)
    @ApiModelProperty("监管时长")
    private Long supervisionTime;
}
